package com.ruoyi.visualization.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.visualization.domain.XianHousePrice;
import com.ruoyi.visualization.service.IXianHousePriceService;

/**
 * 房价预测可视化Controller
 * 
 * @author ruoyi
 * @date 2025-10-30
 */
@RestController
@RequestMapping("/visualization/price")
public class XianHousePriceController extends BaseController
{
    @Autowired
    private IXianHousePriceService xianHousePriceService;

    /**
     * 获取房价趋势数据
     */
    @GetMapping("/trend")
    public AjaxResult getPriceTrend(String areaName, String startQuarter, String endQuarter)
    {
        // 注意：startQuarter和endQuarter参数格式为YYYYMM，如202601代表2026年1月
        List<XianHousePrice> data = xianHousePriceService.selectPriceTrend(areaName, startQuarter, endQuarter);
        return success(data);
    }

    /**
     * 获取区域列表
     */
    @GetMapping("/areas")
    public AjaxResult getAreaList()
    {
        List<String> areas = xianHousePriceService.selectAreaList();
        return success(areas);
    }
}
